<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "authorize_pid".
 *
 * @property integer $id
 * @property integer $qtk_uid
 * @property string $taobao_user_id
 * @property integer $source
 * @property string $type_name
 * @property string $pid_value
 * @property integer $pid_not_match_time
 * @property integer $is_use
 */
class AuthorizePid extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'authorize_pid';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['qtk_uid', 'taobao_user_id', 'source', 'pid_not_match_time', 'is_use'], 'integer'],
            [['type_name'], 'string', 'max' => 20],
            [['pid_value'], 'string', 'max' => 50],
            [['qtk_uid', 'taobao_user_id', 'source', 'type_name'], 'unique', 'targetAttribute' => ['qtk_uid', 'taobao_user_id', 'source', 'type_name'], 'message' => 'The combination of 淘客uid, 淘宝id, 位置 , 1=轻淘客 , 3=c端 and 类型名称 has already been taken.'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'qtk_uid' => Yii::t('app', '淘客uid'),
            'taobao_user_id' => Yii::t('app', '淘宝id'),
            'source' => Yii::t('app', '位置 , 1=轻淘客 , 3=c端'),
            'type_name' => Yii::t('app', '类型名称'),
            'pid_value' => Yii::t('app', 'pid'),
            'pid_not_match_time' => Yii::t('app', 'pid不匹配的时间'),
            'is_use' => Yii::t('app', '当前端是否使用该授权 , 1=使用'),
        ];
    }

    public static function getDb()
    {
        return Yii::$app->get('qtk');
    }
}
